/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JPanelAltaPersona.java
 *
 * Created on 5/05/2012, 12:19:38 AM
 */
package vista.panel;

import controlador.ControladorJPanelAltaPersona;
import controlador.ControladorPrincipal;
import java.awt.event.KeyEvent;
import javax.swing.JTextField;
import modelo.Amigo;
import modelo.Direccion;
import modelo.Persona;
import modelo.Seccion;

/**
 *
 * @author Elias Mendoza
 */
public class JPanelAltaPersona extends javax.swing.JPanel {

//  ControladorPrincipal accion = new ControladorPrincipal();
  static ControladorJPanelAltaPersona accion2;

  private static JPanelAltaPersona panelAltaPersona=null;
  /** Creates new form JPanelAltaPersona */
  private JPanelAltaPersona() {
    initComponents();
    accion2= new ControladorJPanelAltaPersona(this);
    accion2.llenaComboSecciones();
  }
  
  public static JPanelAltaPersona getPanelAltaPersona(){
      if(panelAltaPersona == null){
          System.out.println("creando instancia");
          panelAltaPersona = new JPanelAltaPersona();
      }
      else{
          System.out.println("ya se encontraba una instancia");
      }
      return panelAltaPersona;
  }
  

  /** This method is called from within the constructor to
   * initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is
   * always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        jLabelNombre = new javax.swing.JLabel();
        jLabelCalle = new javax.swing.JLabel();
        jLabelApPaterno = new javax.swing.JLabel();
        jLabelApMaterno = new javax.swing.JLabel();
        jLabelFechaNac = new javax.swing.JLabel();
        jLabelSexo = new javax.swing.JLabel();
        jLabelClaveElec = new javax.swing.JLabel();
        jLabelNumero = new javax.swing.JLabel();
        jLabelColonia = new javax.swing.JLabel();
        jLabelTelefono = new javax.swing.JLabel();
        jTextFieldNombre = new javax.swing.JTextField();
        jTextFieldClaveElec = new javax.swing.JTextField();
        jTextFieldCalle = new javax.swing.JTextField();
        jTextFieldApPaterno = new javax.swing.JTextField();
        jTextFieldApMaterno = new javax.swing.JTextField();
        jTextField1Colonia = new javax.swing.JTextField();
        jTextFieldNumero = new javax.swing.JTextField();
        jTextFieldTelefono = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jButtonBorrar = new javax.swing.JButton();
        jButtonRegistrar = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel5 = new javax.swing.JLabel();
        jPanelDatosGrabados = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextPane1 = new javax.swing.JTextPane();
        jPanel1 = new javax.swing.JPanel();
        jCheckBoxRecordarDireccion = new javax.swing.JCheckBox();
        jSeparator2 = new javax.swing.JSeparator();
        jDateChooserFechaNac = new com.toedter.calendar.JDateChooser();
        jComboBoxSexo = new javax.swing.JComboBox();
        jPanel3 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jComboBoxSeccion = new javax.swing.JComboBox();
        jComboBoxAmigo = new javax.swing.JComboBox();
        jButton1 = new javax.swing.JButton();

        setBackground(new java.awt.Color(255, 255, 255));
        setLayout(new java.awt.GridBagLayout());

        jLabelNombre.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabelNombre.setText("Nombre");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(1, 8, 4, 8);
        add(jLabelNombre, gridBagConstraints);

        jLabelCalle.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabelCalle.setText("Calle");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 10;
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.RELATIVE;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 8, 1, 8);
        add(jLabelCalle, gridBagConstraints);

        jLabelApPaterno.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabelApPaterno.setText("Apellido Paterno");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(1, 8, 4, 8);
        add(jLabelApPaterno, gridBagConstraints);

        jLabelApMaterno.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabelApMaterno.setText("Apellido Materno");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(1, 8, 4, 8);
        add(jLabelApMaterno, gridBagConstraints);

        jLabelFechaNac.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabelFechaNac.setText("Fecha Nacimiento");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 8);
        add(jLabelFechaNac, gridBagConstraints);

        jLabelSexo.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabelSexo.setText("sexo");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.ipadx = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
        add(jLabelSexo, gridBagConstraints);

        jLabelClaveElec.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabelClaveElec.setText("Clave de elector");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 6;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(4, 8, 0, 8);
        add(jLabelClaveElec, gridBagConstraints);

        jLabelNumero.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabelNumero.setText("numero");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 10;
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.RELATIVE;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 8, 1, 8);
        add(jLabelNumero, gridBagConstraints);

        jLabelColonia.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabelColonia.setText("Colonia");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 12;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 8, 1, 8);
        add(jLabelColonia, gridBagConstraints);

        jLabelTelefono.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabelTelefono.setText("teléfono");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 12;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 8, 1, 8);
        add(jLabelTelefono, gridBagConstraints);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 1;
        gridBagConstraints.ipadx = 100;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 13, 1, 8);
        add(jTextFieldNombre, gridBagConstraints);

        jTextFieldClaveElec.setText("0");
        jTextFieldClaveElec.setEnabled(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 6;
        gridBagConstraints.ipadx = 100;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 13, 1, 8);
        add(jTextFieldClaveElec, gridBagConstraints);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 10;
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.RELATIVE;
        gridBagConstraints.ipadx = 150;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 13, 1, 8);
        add(jTextFieldCalle, gridBagConstraints);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.ipadx = 100;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 13, 1, 8);
        add(jTextFieldApPaterno, gridBagConstraints);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.ipadx = 100;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(1, 13, 4, 13);
        add(jTextFieldApMaterno, gridBagConstraints);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 12;
        gridBagConstraints.ipadx = 150;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 13, 1, 8);
        add(jTextField1Colonia, gridBagConstraints);

        jTextFieldNumero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldNumeroActionPerformed(evt);
            }
        });
        jTextFieldNumero.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextFieldNumeroKeyTyped(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 10;
        gridBagConstraints.ipadx = 22;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(1, 13, 4, 13);
        add(jTextFieldNumero, gridBagConstraints);

        jTextFieldTelefono.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextFieldTelefonoKeyTyped(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 12;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.ipadx = 70;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(1, 13, 4, 13);
        add(jTextFieldTelefono, gridBagConstraints);

        jLabel1.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabel1.setText("Sección:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 14;
        gridBagConstraints.ipadx = 4;
        gridBagConstraints.ipady = 6;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
        add(jLabel1, gridBagConstraints);

        jLabel2.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabel2.setText("Amigo:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 15;
        gridBagConstraints.ipadx = 4;
        gridBagConstraints.ipady = 6;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
        add(jLabel2, gridBagConstraints);

        jButtonBorrar.setText("Borrar");
        jButtonBorrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonBorrarActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 17;
        gridBagConstraints.ipadx = 20;
        gridBagConstraints.ipady = 5;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weighty = 0.1;
        gridBagConstraints.insets = new java.awt.Insets(1, 2, 0, 7);
        add(jButtonBorrar, gridBagConstraints);

        jButtonRegistrar.setText("Registrar");
        jButtonRegistrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonRegistrarActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 17;
        gridBagConstraints.ipadx = 20;
        gridBagConstraints.ipady = 5;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weighty = 0.1;
        gridBagConstraints.insets = new java.awt.Insets(1, 2, 0, 7);
        add(jButtonRegistrar, gridBagConstraints);

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 10));
        jLabel3.setForeground(new java.awt.Color(153, 153, 153));
        jLabel3.setText("H/M");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.ipadx = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        add(jLabel3, gridBagConstraints);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 13;
        gridBagConstraints.gridwidth = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        add(jSeparator1, gridBagConstraints);

        jLabel5.setFont(new java.awt.Font("Calibri", 1, 18));
        jLabel5.setText("Registrar nueva Persona");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = 5;
        gridBagConstraints.ipadx = 15;
        gridBagConstraints.ipady = 15;
        add(jLabel5, gridBagConstraints);

        jPanelDatosGrabados.setBackground(new java.awt.Color(255, 255, 255));
        jPanelDatosGrabados.setLayout(new javax.swing.BoxLayout(jPanelDatosGrabados, javax.swing.BoxLayout.LINE_AXIS));

        jScrollPane1.setBackground(new java.awt.Color(255, 255, 255));
        jScrollPane1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Ult. Registro", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 10))); // NOI18N

        jTextPane1.setBorder(null);
        jTextPane1.setEditable(false);
        jTextPane1.setFont(new java.awt.Font("Tahoma", 0, 10));
        jScrollPane1.setViewportView(jTextPane1);

        jPanelDatosGrabados.add(jScrollPane1);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 17;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.gridheight = 5;
        gridBagConstraints.ipadx = 150;
        gridBagConstraints.ipady = 150;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.PAGE_START;
        add(jPanelDatosGrabados, gridBagConstraints);

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));

        jCheckBoxRecordarDireccion.setBackground(new java.awt.Color(255, 255, 255));
        jCheckBoxRecordarDireccion.setFont(new java.awt.Font("Tahoma", 0, 10));
        jCheckBoxRecordarDireccion.setForeground(new java.awt.Color(153, 153, 153));
        jCheckBoxRecordarDireccion.setText("Recordar Datos");
        jPanel1.add(jCheckBoxRecordarDireccion);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 17;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        add(jPanel1, gridBagConstraints);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.gridwidth = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END;
        gridBagConstraints.insets = new java.awt.Insets(6, 13, 1, 8);
        add(jSeparator2, gridBagConstraints);

        jDateChooserFechaNac.setEnabled(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.ipadx = 25;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 13, 0, 0);
        add(jDateChooserFechaNac, gridBagConstraints);

        jComboBoxSexo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "H", "M" }));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        add(jComboBoxSexo, gridBagConstraints);

        jPanel3.setLayout(new java.awt.GridBagLayout());

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
        jPanel2.setLayout(new java.awt.GridLayout(2, 0));

        jComboBoxSeccion.setFont(new java.awt.Font("Times New Roman", 1, 12));
        jComboBoxSeccion.setAutoscrolls(true);
        jComboBoxSeccion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxSeccionActionPerformed(evt);
            }
        });
        jPanel2.add(jComboBoxSeccion);

        jComboBoxAmigo.setFont(new java.awt.Font("Times New Roman", 1, 12));
        jPanel2.add(jComboBoxAmigo);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        jPanel3.add(jPanel2, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 14;
        gridBagConstraints.gridheight = 3;
        add(jPanel3, gridBagConstraints);

        jButton1.setText("refrescar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        add(jButton1, new java.awt.GridBagConstraints());
    }// </editor-fold>//GEN-END:initComponents

  private void jTextFieldNumeroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldNumeroActionPerformed
    // TODO add your handling code here:
  }//GEN-LAST:event_jTextFieldNumeroActionPerformed

  private void jTextFieldNumeroKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldNumeroKeyTyped
    // TODO add your handling code here:
//    if (!accion.compruebaCaracterNumero((int) evt.getKeyChar())) {
//      evt.setKeyChar((char) KeyEvent.VK_CLEAR);
//    }
  }//GEN-LAST:event_jTextFieldNumeroKeyTyped

  private void jTextFieldTelefonoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldTelefonoKeyTyped
    // TODO add your handling code here:
//    if (!accion.compruebaCaracterNumero((int) evt.getKeyChar())) {
//      evt.setKeyChar((char) KeyEvent.VK_CLEAR);
//    }
  }//GEN-LAST:event_jTextFieldTelefonoKeyTyped

  private void jButtonRegistrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRegistrarActionPerformed
    // TODO add your handling code here:
//    JTextField[] campos = {jTextField1Colonia, jTextFieldApMaterno, jTextFieldApPaterno, jTextFieldCalle,
//       jTextFieldNombre, jTextFieldNumero};
//    if (!accion.camposVacios(campos)) {
//      Direccion direccion = new Direccion();
//      direccion.setCalle(jTextFieldCalle.getText());
//      direccion.setColonia(jTextField1Colonia.getText());
//      direccion.setNumero(Integer.parseInt(jTextFieldNumero.getText()));
//      direccion.setTelefono(jTextFieldTelefono.getText());
//
//      Persona persona = new Persona();
//      persona.setApellidoMaterno(jTextFieldApMaterno.getText());
//      persona.setApellidoPaterno(jTextFieldApPaterno.getText());
//      persona.setClaveElector(jTextFieldClaveElec.getText());
//      persona.setSexo(jComboBoxSexo.getSelectedItem().toString());
//      persona.setDireccion(direccion);
//      persona.setFechaNacimiento(jDateChooserFechaNac.getDate());
//      persona.setNombre(jTextFieldNombre.getText());
//      persona.setSeccion((Seccion) jComboBoxSeccion.getSelectedItem());
//      persona.setAmigo((Amigo) jComboBoxAmigo.getSelectedItem());
//
//      if(!accion.compruebaExistencia(persona.getNombre(),persona.getApellidoPaterno(),persona.getApellidoMaterno())){
//        accion.registrar(persona, 2, jTextPane1);
//      }
//      if(jCheckBoxRecordarDireccion.isSelected()){
//        JTextField[] campos_a_vaciar = {jTextFieldApMaterno, jTextFieldApPaterno, jTextFieldNombre};
//        accion.vaciaCampos(campos_a_vaciar);
//       
//      }
//      else{
//        accion.vaciaCampos(campos);
//      }
//       jDateChooserFechaNac.setDate(null);
////       accion.imprimeDatosgrabados(persona, jTextPane1);
//       
//    }
    accion2.registrarPersona();
    
  }//GEN-LAST:event_jButtonRegistrarActionPerformed

  private void jButtonBorrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBorrarActionPerformed
    // TODO add your handling code here:
//     if(jCheckBoxRecordarDireccion.isSelected()){
//        JTextField[] campos_a_vaciar = {jTextFieldApMaterno, jTextFieldApPaterno, jTextFieldNombre};
//        accion.vaciaCampos(campos_a_vaciar);
//      }
//     else{
//        JTextField[] campos = {jTextField1Colonia, jTextFieldApMaterno, jTextFieldApPaterno, jTextFieldCalle,
//      jTextFieldNombre, jTextFieldNumero};
//        accion.vaciaCampos(campos);
//      
//     }
//       jDateChooserFechaNac.setDate(null);
  }//GEN-LAST:event_jButtonBorrarActionPerformed

  private void jComboBoxSeccionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxSeccionActionPerformed
    // TODO add your handling code here:
    accion2.llenaComboAmigosBySeccion();
  }//GEN-LAST:event_jComboBoxSeccionActionPerformed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
    accion2.llenaComboSecciones();
}//GEN-LAST:event_jButton1ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    public javax.swing.JButton jButton1;
    public javax.swing.JButton jButtonBorrar;
    public javax.swing.JButton jButtonRegistrar;
    public javax.swing.JCheckBox jCheckBoxRecordarDireccion;
    public javax.swing.JComboBox jComboBoxAmigo;
    public javax.swing.JComboBox jComboBoxSeccion;
    public javax.swing.JComboBox jComboBoxSexo;
    public com.toedter.calendar.JDateChooser jDateChooserFechaNac;
    public javax.swing.JLabel jLabel1;
    public javax.swing.JLabel jLabel2;
    public javax.swing.JLabel jLabel3;
    public javax.swing.JLabel jLabel5;
    public javax.swing.JLabel jLabelApMaterno;
    public javax.swing.JLabel jLabelApPaterno;
    public javax.swing.JLabel jLabelCalle;
    public javax.swing.JLabel jLabelClaveElec;
    public javax.swing.JLabel jLabelColonia;
    public javax.swing.JLabel jLabelFechaNac;
    public javax.swing.JLabel jLabelNombre;
    public javax.swing.JLabel jLabelNumero;
    public javax.swing.JLabel jLabelSexo;
    public javax.swing.JLabel jLabelTelefono;
    public javax.swing.JPanel jPanel1;
    public javax.swing.JPanel jPanel2;
    public javax.swing.JPanel jPanel3;
    public javax.swing.JPanel jPanelDatosGrabados;
    public javax.swing.JScrollPane jScrollPane1;
    public javax.swing.JSeparator jSeparator1;
    public javax.swing.JSeparator jSeparator2;
    public javax.swing.JTextField jTextField1Colonia;
    public javax.swing.JTextField jTextFieldApMaterno;
    public javax.swing.JTextField jTextFieldApPaterno;
    public javax.swing.JTextField jTextFieldCalle;
    public javax.swing.JTextField jTextFieldClaveElec;
    public javax.swing.JTextField jTextFieldNombre;
    public javax.swing.JTextField jTextFieldNumero;
    public javax.swing.JTextField jTextFieldTelefono;
    public javax.swing.JTextPane jTextPane1;
    // End of variables declaration//GEN-END:variables
}
